home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 2 / CU Amiga Magazine's Super CD-ROM 02 (1996)(EMAP Images)(GB)[!][issue 1996-04].iso / magazine / amiga_e / amigae.june.archive / 000103_crash!minyos.xx….OZ.AU!s924723_Wed, 16 Jun 93 17:50:21 PST.msg < prev    next >
Text File  |  1993-08-31  |  3KB  |  65 lines

  1. Received: by bkhouse.cts.com (V1.16/Amiga)
  2.     id AA00000; Wed, 16 Jun 93 17:50:21 PST
  3. Received: from peladon.rmit.OZ.AU by crash.cts.com with smtp
  4.     (Smail3.1.28.1 #15) id m0o67Uw-0000i8C; Wed, 16 Jun 93 17:06 PDT
  5. Received: from minyos.xx.rmit.OZ.AU by peladon.rmit.OZ.AU with SMTP id AA13650
  6.   (5.65c/IDA-1.4.4 for <amigae@bkhouse.cts.com>); Thu, 17 Jun 1993 10:05:35 +1000
  7. Received: by minyos.xx.rmit.oz.au
  8. Date: Thu, 17 Jun 93 10:05:10 EST
  9. Message-Id: <9306170005.3700@minyos.xx.rmit.oz.au>
  10. From: s924723@minyos.xx.rmit.OZ.AU (Son Huu Le)
  11. To: amigae@bkhouse.cts.com
  12. Subject: 
  13.  
  14.  
  15. What a surprise, Barry.. I was just asking you about list and strings in E,
  16. now I have to explain the same things back to you in assembly. (;
  17.  
  18. >  table := [2,4,6,8,10] : INT
  19.  
  20. In asm, table contains an address pointing to 2L,4L,6L,8L,10L (it's a
  21. pointer to this).
  22.  
  23.   eg. [table] -> [2,4,6,8,10]
  24.      location    address with contents
  25.          with
  26.       address
  27.  
  28. To access the contents of table you must move the address into an address
  29. register and do indirect calls.
  30.  
  31.   eg. MOVE.L  table,A0
  32.       MOVE.W  (A0),D0
  33.  
  34. D0 now contains 2. To get the next content, you must increase address by
  35. 2 to get a pointer to the next content.
  36.  
  37.   eg. ADD.L   #2,A0        Which is the same as  MOVE.W  2(A0),D0
  38.       MOVE.W  (A0),D0                            address with 2 offset.
  39.  
  40. >                           /* What's wrong with this? */
  41. >        MOVEA.L #table,A0  /* ERROR:  unknown/illegal addressing mode. */
  42.  
  43. Firstly this won't work as table contains a pointer so if it did work you'd
  44. need to do an extra MOVE.L (A0),A1 to get the content's address. Secondly,
  45. EC complains because in E table is already an address offset (ie. 2(Ax), I
  46. think!) so the command MOVE.L #2(Ax),A0 is illegal (not #immediate!).
  47. This is the same reason why #table+2 won' work.
  48.  
  49. >        MOVEA.L table,A0  /* WORKS.      */
  50. >     /* MOVE.L  table,A0  works as well. */
  51. >     /* LEA     table,A0  does not work. */
  52.  
  53. MOVE.L is a shorthand for MOVE.L and MOVEA.L (for people like us who can't
  54. remember to do MOVEA.L when we mean MOVE.L :) difference being if the dest.
  55. is an address register, the proper form is MOVEA.L, but most assemblers
  56. do it automatically for you.
  57.  
  58. The LEA command is.. correct, I think. Don't know why it doesn't work. (;
  59. (That is, it's looks okay to me, but I don't know enough asm to say :)
  60.  
  61. Bye!
  62. Son Le
  63.  
  64. PS. I'm no assembly coder, so I can't guarantee whay I've said is 100%
  65. correct, but it should give you a better understanding of assembly E.